<?php

class Bemigo_ProfileController extends Bemigo_Controller_Action_Base_Profile
{

	public function init()
	{
		parent::init();
		$this->view->fb_app_id = Zend_Registry::get("configuration")->facebook->app->id;
	}

	public function indexAction(){
		$this->checkFBAuth();
		$this->checkRelationship();
		$this->view->editor_name = $this->_user->getName();
		$this->view->friend_name = $this->_friend->getName();
		$this->view->friend_fb_id = $this->_friend->getFacebookId();
		$albums = $this->_facebook->getAlbums($this->_friend->getFacebookId());
		foreach ($albums["data"] as $album){
			if($album['type'] == "profile"){
				$this->view->profile_pictures = $this->_facebook->getPhotos($album['id']);
				break;
			}
		}
		$recommend = new Application_Service_Recommend($this->_friend, $this->_facebook);
		$this->view->movies = $recommend->getMovies(10);

	}

	public function basicAction(){
		$this->checkFBAuth();
		$this->checkRelationship();
		$this->view->user_name = $this->_user->getName();
		$this->view->user_id = $this->_facebook->getUser();
		$this->view->friend_name = $this->_friend->getName();
		$this->view->friend_fb_id = $this->_friend->getFacebookId();
		$albums = $this->_facebook->getAlbums($this->_friend->getFacebookId());
		foreach ($albums["data"] as $album){
			if($album['type'] == "profile"){
				$this->view->profile_pictures = $this->_facebook->getPhotos($album['id']);
				break;
			}
		}
	}

	public function personalityAction(){
		$this->checkFBAuth();
		$this->checkRelationship();
		$this->view->editor_name = $this->_user->getName();
		$this->view->friend_name = $this->_friend->getName();
		$this->view->friend_fb_id = $this->_friend->getFacebookId();
		$recommend = new Application_Service_Recommend($this->_friend, $this->_facebook);
		$this->view->movies = $recommend->getMovies(5);
	}


}